﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using STT.Layer.Connection;
namespace STT.Profile.UserControls
{
    public partial class ThongTinKhoaHoc : System.Web.UI.UserControl
    {
        ToolBox tb = new ToolBox();
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadKhoaHoc();
        }
        private void LoadKhoaHoc()
        {
            try
            {
                DataTable dt2 = tb.GetDataTableById2("GetKhoaHocByMaHV", Session["MaFhv"].ToString());
                DataTable dt = tb.GetDataTableById4("GetDSKhoaHocByMaHV", Session["MaFhv"].ToString(), tb.GetDataTableById2("Get_HocVien_ByMaHV", Session["MaFhv"].ToString()).Rows[0]["MaLop"].ToString());
                pnchitietkhoahoc.Visible = true;
                dtlkhoahoclq.DataSource = dt;
                dtlkhoahoclq.DataBind();
                dtlndkh.DataSource = dt2;
                dtlndkh.DataBind();
                dtlkhoahochientai.DataSource = dt2;
                dtlkhoahochientai.DataBind();
            }
            catch { }
        }
        protected void dtlkhoahoclq_ItemCommand(object source, DataListCommandEventArgs e)
        {
            if (e.CommandName == "Lbtchitiet")
            {
                string id = dtlkhoahoclq.DataKeys[e.Item.ItemIndex].ToString();
                DataTable dt = tb.GetDataTableById("GetKhoaHocByMaKhoaHoc", id);
                dtlndkh.DataSource = dt;
                dtlndkh.DataBind();
            }
        }

        protected void dtlkhoahochientai_ItemCommand(object source, DataListCommandEventArgs e)
        {
            if (e.CommandName == "Lbtchitietkhht")
            {
                string id = dtlkhoahochientai.DataKeys[e.Item.ItemIndex].ToString();
                dtlndkh.DataSource = tb.GetDataTableById("GetKhoaHocByMaKhoaHoc", id);
               
                dtlndkh.DataBind();
            }
        }

      
    }
}